/*
 * @lc app=leetcode.cn id=191 lang=javascript
 *
 * [191] 位1的个数
 */

// @lc code=start
/**
 * @param {number} n - a positive integer
 * @return {number}
 */
var hammingWeight = function(n) {
    let frequency = 0
    while(n) {
        n = n & (n - 1)
        frequency++
    }
    return frequency
};
// @lc code=end


/* 
    涉及到位运算，输入的是0b开头的二进制数
*/
